from haystack.indexes import *
from haystack import site
from models import Serie, Capitulo

class SerieIndex(SearchIndex):
        text = CharField(document=True, use_template=True)
        name_en = CharField(model_attr='name_en')
        name_es = CharField(model_attr='name_es')
        #description_es = CharField(model_attr='description_es')
        #pub_date = DateTimeField(model_attr='pub_date')

        #def get_queryset(self):
         #       """Used when the entire index for model is updated."""
         #       return Serie.objects.filter(pub_date__lte=datetime.datetime.now())
         
site.register(Serie, SerieIndex)

class CapituloIndex(SearchIndex):
        text = CharField(document=True, use_template=True)
        name_es = CharField(model_attr='name_es')
        name_en = CharField(model_attr='name_en')
        
        #usa_date = DateTimeField(model_attr='usa_date')
        
        #def get_queryset(self):
        #       """Used when the entire index for model is updated."""
        #        return Capitulo.objects.filter(usa_date__lte=datetime.datetime.now())
                
site.register(Capitulo, CapituloIndex)